<?php

namespace app\common\business;

class LocationConfig
{
    public static $location=[
        1=>[
            'name'=>'安定区',
            'db'=>'adq_job_supermarket',
            'app_id'=>'wxdb2c62fa132a123e',
            'app_secret'=>'12364f4fec474fcb45ae6d5bfd478615',
            'login_url' => 'https://api.weixin.qq.com/sns/jscode2session?',
            'get_access_token_url' => 'https://api.weixin.qq.com/cgi-bin/token?',
            'get_phone_url' => 'https://api.weixin.qq.com/wxa/business/getuserphonenumber?',
            'redis_prefix'=>'adq_'
        ],
    ];

    public static function getDbName(){
        $pathInfo=request()->server('PATH_INFO');
        $location=request()->header()['location-id'];
        if(empty($location)||(strpos($pathInfo,'/api/')===false&&strpos($pathInfo,'/admin/')===false&&strpos($pathInfo,'/screen/')===false)){
            echo '参数错误';exit;
        }
        return self::$location[$location]['db'];
    }

    public static function getConfByLocation(){
        $location=request()->header()['location-id'];
        return self::$location[$location];
    }
}
